home *** CD-ROM | disk | FTP | other *** search
/ OpenGL Superbible (2nd Edition) / OpenGL SuperBible e2.iso / tools / FLTK-1.0.6 / test / output.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1999-01-07  |  2.8 KB  |  102 lines

  1. //
  2. // "$Id: output.cxx,v 1.4 1999/01/07 19:17:59 mike Exp $"
  3. //
  4. // Output test program for the Fast Light Tool Kit (FLTK).
  5. //
  6. // Copyright 1998-1999 by Bill Spitzak and others.
  7. //
  8. // This library is free software; you can redistribute it and/or
  9. // modify it under the terms of the GNU Library General Public
  10. // License as published by the Free Software Foundation; either
  11. // version 2 of the License, or (at your option) any later version.
  12. //
  13. // This library is distributed in the hope that it will be useful,
  14. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  16. // Library General Public License for more details.
  17. //
  18. // You should have received a copy of the GNU Library General Public
  19. // License along with this library; if not, write to the Free Software
  20. // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
  21. // USA.
  22. //
  23. // Please report all bugs and problems to "fltk-bugs@easysw.com".
  24. //
  25.  
  26. #include <FL/Fl.H>
  27. #include <FL/Fl_Value_Input.H> // necessary for bug in mingw32?
  28. #include <FL/Fl_Window.H>
  29. #include <FL/Fl_Box.H>
  30. #include <FL/Fl_Hor_Value_Slider.H>
  31. #include <FL/Fl_Toggle_Button.H>
  32. #include <FL/Fl_Input.H>
  33. #include <FL/fl_draw.H>
  34. #include <FL/Fl_Output.H>
  35. #include <FL/Fl_Multiline_Output.H>
  36.  
  37. Fl_Output *text;
  38. Fl_Multiline_Output *text2;
  39. Fl_Input *input;
  40. Fl_Value_Slider *fonts;
  41. Fl_Value_Slider *sizes;
  42. Fl_Window *window;
  43.  
  44. void font_cb(Fl_Widget *,void *) {
  45.   text->textfont(int(fonts->value()));
  46.   text->redraw();
  47.   text2->textfont(int(fonts->value()));
  48.   text2->redraw();
  49. }
  50.  
  51. void size_cb(Fl_Widget *,void *) {
  52.   text->textsize(int(sizes->value()));
  53.   text->redraw();
  54.   text2->textsize(int(sizes->value()));
  55.   text2->redraw();
  56. }
  57.  
  58. void input_cb(Fl_Widget *,void *) {
  59.   text->value(input->value());
  60.   text2->value(input->value());
  61. }
  62.  
  63. int main(int argc, char **argv) {
  64.   window = new Fl_Window(400,400);
  65.  
  66.   input = new Fl_Input(50,0,350,25);
  67.   input->static_value("The quick brown fox\njumped over\nthe lazy dog.");
  68.   input->when(FL_WHEN_CHANGED);
  69.   input->callback(input_cb);
  70.  
  71.   sizes = new Fl_Hor_Value_Slider(50,25,350,25,"Size");
  72.   sizes->align(FL_ALIGN_LEFT);
  73.   sizes->bounds(1,64);
  74.   sizes->step(1);
  75.   sizes->value(14);
  76.   sizes->callback(size_cb);
  77.  
  78.   fonts = new Fl_Hor_Value_Slider(50,50,350,25,"Font");
  79.   fonts->align(FL_ALIGN_LEFT);
  80.   fonts->bounds(0,15);
  81.   fonts->step(1);
  82.   fonts->value(0);
  83.   fonts->callback(font_cb);
  84.  
  85.   text2 = new Fl_Multiline_Output(100,150,200,100,"Fl_Multiline_Output");
  86.   text2->value(input->value());
  87.   text2->align(FL_ALIGN_BOTTOM);
  88.   window->resizable(text2);
  89.  
  90.   text = new Fl_Output(100,280,200,30,"Fl_Output");
  91.   text->value(input->value());
  92.   text->align(FL_ALIGN_BOTTOM);
  93.  
  94.   window->forms_end();
  95.   window->show(argc,argv);
  96.   return Fl::run();
  97. }
  98.  
  99. //
  100. // End of "$Id: output.cxx,v 1.4 1999/01/07 19:17:59 mike Exp $".
  101. //
  102.